#pragma config(Sensor, in1,    ,               sensorLineFollower)
#pragma config(Sensor, in2,    ,               sensorLineFollower)
#pragma config(Sensor, in3,    ,               sensorLineFollower)
#pragma config(Sensor, dgtl2,  ultra,          sensorSONAR_inch)
#pragma config(Sensor, dgtl4,  rightbumper,    sensorTouch)
#pragma config(Sensor, dgtl5,  leftbumper,     sensorTouch)
#pragma config(Motor,  port2,           rightMotor,    tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port3,           leftMotor,     tmotorServoContinuousRotation, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

void forward (int time)
{
  motor[rightMotor] = 127;
	motor[leftMotor]  = 115;
	wait1Msec(time);
}
void backward (int time)
{
  motor[rightMotor] = -60 ;
  motor[leftMotor] = -60
}
void stoprobot (int time){
  motor[rightMotor] = 0;
	motor[leftMotor] = 0;
	wait1Msec(time);
}
void right (int time){
  motor[rightMotor] = 200;
  motor[leftMotor] = 10;
  wait1Msec(time);
}
void left (int time){
  motor[rightMotor] = 10;
  motor[leftMotor] = 200;
  wait1Msec(time);
}
/*void linefollow(){
  int threshold=700;
  if (SensorValue(leftsensor)<threshold){
      motor[rightMotor] = 25;
      motor[leftMotor] = 35;
  }
   if (SensorValue(rightsensor)<threshold){
    motor[rightMotor] =35;
    motor[leftMotor] = 25;
  }
   if (SensorValue(centersensor)<threshold){
    motor[rightMotor] = 25;
    motor[leftMotor] = 25;
  }
}
*/
int speed=-40;
task main(){
while (1==1){
  if((SensorValue(ultra)<5)&& (SensorValue(ultra)>0)){
    motor[rightMotor] = -35;
    motor[leftMotor] = 40;
    wait1Msec(3000);
    motor[rightMotor]=;
    motor[leftMotor]=;
    wait1Msec(1500);
}else if ((SensorValue(leftbumper)==1)||(SensorValue(rightbumper)==1)){
    motor[rightMotor] =  ;
    motor[leftMotor] = ;
    wait1Msec(3000);
    motor[rightMotor]=;
    motor[leftMotor]=;
    wait1Msec(1500);
}else{
   motor[rightMotor]=35;
    motor[leftMotor]=-40;
  }
}
}
